package com.engine4cloud.tdf.education.convert;

import com.engine4cloud.tdf.common.core.util.CodeUtils;
import com.engine4cloud.tdf.education.dto.create.EduPublicWelfareActivitiesCreateDTO;
import com.engine4cloud.tdf.education.dto.result.EduPublicWelfareActivitiesResultDTO;
import com.engine4cloud.tdf.education.dto.update.EduPublicWelfareActivitiesUpdateDTO;
import com.engine4cloud.tdf.education.entity.EduPublicWelfareActivitiesEntity;
import org.mapstruct.Mapper;
import org.mapstruct.factory.Mappers;


@Mapper
public interface EduPublicWelfareActivitiesConvert {
    EduPublicWelfareActivitiesConvert INSTANCE = Mappers.getMapper(EduPublicWelfareActivitiesConvert.class);

    EduPublicWelfareActivitiesEntity createTo(EduPublicWelfareActivitiesCreateDTO s);

    EduPublicWelfareActivitiesEntity update(EduPublicWelfareActivitiesUpdateDTO s);

    EduPublicWelfareActivitiesResultDTO convert(EduPublicWelfareActivitiesEntity s);

    default EduPublicWelfareActivitiesEntity create(EduPublicWelfareActivitiesCreateDTO s, Long tenantId) {
        EduPublicWelfareActivitiesEntity entity = createTo(s);
        entity.setHdbh(CodeUtils.entrustCode());
        entity.setTenantId(tenantId);
        return entity;
    }
}
